//
//  BaseNavigationController.swift
//  GhostWorld
//
//  Created by Kam on 2018/4/2.
//  Copyright © 2018 LKGood. All rights reserved.
//

import UIKit

protocol BaseNavigationControllerDismissDelegate {
  func dismiss(navigationController: BaseNavigationController, completion: (() -> Void)?)
}

class BaseNavigationController: UINavigationController {
  
  // MARK: - IBOutlets
  
  
  
  // MARK: - Private vars
  
  
  
  // MARK: - Private methods
  
  
  
  // MARK: - Public vars
  
   var dismissDelegate: BaseNavigationControllerDismissDelegate?
  
  // MARK: - Lifecycle
  
  override func viewDidLoad() {
    super.viewDidLoad()
    
    // Do any additional setup after loading the view.
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
  
  // MARK: - IBActions
  
  
  
  // MARK: - Public vars
  
  var isPresentedModally = false
}

extension BaseNavigationController {
  convenience init(rootViewController: UIViewController, dismissDelegate: BaseNavigationControllerDismissDelegate) {
    self.init(rootViewController: rootViewController)
    navigationBar.tintColor = UIColor(fromPreeset: .globalTint)
    navigationBar.barTintColor = UIColor(fromPreeset: .navBarTint)
    navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor(fromPreeset: .navTitleColor)]
    
    self.dismissDelegate = dismissDelegate
  }
}
